package testing.ms3;

import org.junit.Test;

import app_kvEcs.ECS;
import app_kvEcs.MemorySpace;
import junit.framework.TestCase;

public class AdditionalTest extends TestCase {
	
	// TODO add your test cases, at least 3
	
	@Test
	public void testStub() {
		assertTrue(true);
	}
	
	@Test
	public void testRemoveNode(){
		ECS ecs = new ECS();
		ecs.initService(10,false);
		MemorySpace servers = ecs.getServers();
		
		String nodeName = "node1";
		String result = servers.toString();
		assertTrue(result.contains(nodeName));
		
		
		nodeName = "node4";
//		result = "\nREMOVE " + nodeName +"\n";
		result = servers.removeNode(nodeName) +"\n";
		result += servers.toString();
		System.out.println(result);
		assertTrue(!result.contains(nodeName));
		
		nodeName = "node7";
//		result = "\nREMOVE " + nodeName+"\n";
		result = servers.removeNode(nodeName)+"\n";
		result += servers.toString();
		System.out.println(result);
		assertTrue(!result.contains(nodeName));
		
		nodeName = "node9";
//		result = "\nREMOVE " + nodeName+"\n";
		result = servers.removeNode(nodeName)+"\n";
		result += servers.toString();
		System.out.println(result);
		assertTrue(!result.contains(nodeName));
	}
}
